<!DOCTYPE html>
<html lang="zh">

<head>
    <title>首页 - Log4j2 核弹级漏洞演示</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="UTF-8"/>
    <meta name="keywords" content="Log4j2,漏洞,安全"/>
    <link rel="stylesheet" href="css/css2.css">
    <link rel="stylesheet" href="css/style.css" type="text/css" media="all"/>
    <link rel="stylesheet" href="css/font-awesome.min.css" type="text/css" media="all">
</head>

<body>

<section class="w3l-hotair-form">
    <h1>Log4j2 核弹级漏洞演示</h1>
    <div class="container">

        <h2>当前登录用户信息</h2>
        <p><b>用户账户:</b><span id="act"> - </span></p>
        <p><b>登录时间:</b><span id="lat"> - </span></p>
        <button id="logout-btn" class="btn" type="button">注销</button>

    </div>
    <div class="copyright text-center">
        <p class="copy-footer-29">Copyright &copy; 2021 LANGDASHU.COM All rights reserved.
            <a target="_blank" href="https://gitee.com/Morningyet/Log4j2-CVE-2021-44228">明天徐(https://gitee.com/Morningyet/Log4j2-CVE-2021-44228)</a>
        </p>
    </div>
</section>
<script src="js/jquery.min.js"></script>

<script>
    let token = window.localStorage.getItem('bug-log4j2-token')

    $.ajax({
        type: "GET",
        url: "/user/info",
        dateType: 'json',
        async: false,
        beforeSend: function (request) {
            request.setRequestHeader("bug-log4j2-token", token);
        },
        error: function (request) {
            alert(request.responseText);
            window.location.href = "/login.html"
            console.log(request)
        },
        success: function (data) {
            $("#act").html(data.act)
            $("#lat").html(data.lat)
        }
    });

    $("#logout-btn").click(function () {
        token = window.localStorage.getItem('bug-log4j2-token')
        $.ajax({
            type: "GET",
            url: "/user/logout",
            dateType: 'json',
            async: false,
            beforeSend: function (request) {
                request.setRequestHeader("bug-log4j2-token", token);
            },
            error: function (request) {
                alert(request.responseText);
            },
            success: function (data) {
                alert("注销成功")
                window.location.href = "/login.html"
            }
        });
    });
</script>

</body>
</html>